package com.basic.member.mapper;

import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * ClassName: MemberMenuExMapper
 * Package: com.basic.member.mapper
 * Description:
 *
 * @Author: Night
 * @Create: 2024/9/13 - 9:10
 * @Version: 1.0
 */
@Mapper
public interface MemberMenuExMapper {
    /** 查看时候存在子菜单 */
    @Select("SELECT has_sub FROM app_menu WHERE id = #{id}")
    boolean selHasSub(@Param("id") Integer id);

    /** 根据父Id获取所有子系统Id */
    @Select("SELECT id FROM app_menu WHERE parent_id = #{parentId}")
    List<Integer> selIdListByParentId(@Param("parentId") Integer parentId);

    @Select("SELECT COUNT(*) \n" +
            "FROM member_info i\n" +
            "INNER JOIN member_menu m\n" +
            "ON i.bo_id = m.bo_id\n" +
            "WHERE i.c_name = #{cName} \n" +
            "AND i.d_name = #{dName} \n" +
            "AND m.menu_id = #{menuId};")
    int selectCountByParams(Integer menuId, String cName, String dName);
}
